package cn.freeprogrammer.igen.data;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import cn.freeprogrammer.igen.data.type.JavaType;

public class EntityData {
	private String packageName;
	
	private String tableName;
	
	private String entityName;
	
	private String fullEntityName;
	
	private String lowerCaseEntityName;
	
	private FieldData primaryKey;
	
	private List<FieldData> fields = new LinkedList<FieldData>();
	
	private Set<JavaType> imports = new HashSet<JavaType>();
	
	public void addField(FieldData fieldData) {
		fields.add(fieldData);
		
		JavaType javaType = fieldData.getFieldType().getJavaType();
		if (javaType.needsImport()) {
			imports.add(javaType);
		}
	}
	public String getTableName() {
		return tableName;
	}
	public void setTableName(String tableName) {
		this.tableName = tableName;
	}
	public String getEntityName() {
		return entityName;
	}
	public void setEntityName(String entityName) {
		this.entityName = entityName;
		this.lowerCaseEntityName = entityName.toLowerCase();
	}
	public String getFullEntityName() {
		return fullEntityName;
	}
	public void setFullEntityName(String fullEntityName) {
		this.fullEntityName = fullEntityName;
	}
	public String getLowerCaseEntityName() {
		return lowerCaseEntityName;
	}
	public void setLowerCaseEntityName(String lowerCaseEntityName) {
		this.lowerCaseEntityName = lowerCaseEntityName;
	}
	public List<FieldData> getFields() {
		return fields;
	}
	public void setFields(List<FieldData> fields) {
		this.fields = fields;
	}
	public FieldData getPrimaryKey() {
		return primaryKey;
	}
	public void setPrimaryKey(FieldData primaryKey) {
		this.primaryKey = primaryKey;
	}
	public String getPackageName() {
		return packageName;
	}
	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}
	public Set<JavaType> getImports() {
		return imports;
	}
}
